<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div id="main_group_list" class="easyui-layout" fit="true">
    <div region="center" style="padding:0px;border:0px">
        <t:datagrid name="groupList" title="集团信息维护" actionUrl="groupPRController.do?groupGrid" idField="id" treegrid="false" pagination="true"  sortOrder="desc" sortName="id" onLoadSuccess="">
            <t:dgCol title="激活状态编码" field="activeState" hidden="true"></t:dgCol>
            <t:dgCol title="集团编号" field="id"></t:dgCol>
            <t:dgCol title="集团名称" field="groupName" width="100" query="true"></t:dgCol>
            <t:dgCol title="查询方式" field="queryModeDesc" width="50"></t:dgCol>
            <t:dgCol title="查询日期" field="queryDate" width="50"></t:dgCol>
            <t:dgCol title="联系人" field="contactMan" width="50" query="true"></t:dgCol>
            <t:dgCol title="联系电话" field="contactPhone" width="70" query="true"></t:dgCol>
            <t:dgCol title="联系人邮箱" field="contactEmail" width="90" query="true"></t:dgCol>
            <t:dgCol title="启用状态" field="stateDesc" width="35"></t:dgCol>
            <t:dgCol title="激活状态" field="activeStateDesc" width="35"></t:dgCol>
			<t:dgCol title="common.operation" field="opt" width="60"></t:dgCol>
            <t:dgDelOpt url="groupPRController.do?delGroup&id={id}" title="删除"></t:dgDelOpt>
            <t:dgFunOpt funname="setCustomerNo(id,groupName,activeState)" title="户号维护"></t:dgFunOpt>
            <t:dgToolBar title="新增" icon="icon-add" url="groupPRController.do?aouGroup" funname="add" height="430"></t:dgToolBar>
            <t:dgToolBar title="编辑" icon="icon-edit" url="groupPRController.do?aouGroup" funname="update" height="430"></t:dgToolBar>
        </t:datagrid>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        
    });

    function setCustomerNo(id, groupName){
    	 var activeState = checkGroupActive(id);
		 if(activeState=='0'){
			 $.messager.alert('&nbsp;&nbsp;信息提醒','当前锁定状态，不能进行该项操作！', 'info');
		 }else{
			 parent.addTabs({id:id,title:groupName+'户号维护',close: true,url: "groupPRController.do?goCustomerNoGrid&groupid="+id});
			// createdetailwindow(groupName,"groupPRController.do?goCustomerNoGrid&groupid="+id,850,520) 
		 }
    }
    
    //检查集团激活状态
    var checkGroupActive = function(id){
    	var activeState;
    	$.ajax({
    		async : false,
    		cache : false,
    		type : 'POST',
    		url : "groupPRController.do?checkGroupActive&groupid="+id,
    		error : function() {// 请求失败处理函数
    		},
    		success : function(data) {
    			var d = $.parseJSON(data);
    			if (d.success) {
    				activeState = d.msg;    				 
    			}    			
    		}
    	}); 
    	return activeState;
    }

</script>
